package xhwl.hmo.mall.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by admin on 2017-09-06.
 */

public class SpUtil {
    private static final String SP_NAME = "user_info";

    private static SharedPreferences infoShare = null;
    public static final String MEMBER_ID = "member_id";//会员Id
    public static final String MEMBER_MOBILE ="member_mobile"; // 会员手机号
    public static final String SHOW_GUIDE="show_guide";//是否显示引导页
    public static final String JPUSH_ID="jpush_id";//极光id
    public static final String PUSH_ON="push_on";//极光推送开关
    public static final String HAS_UPDATE_DEVICE_INFO="has_update_deviceinfo";//是否更新应用设备信息
    public static final String ORDER_NO="order_no";//保存当前支付的订单号
    public static final String MEMBER_HEAD ="member_head" ;//用户头像
    public static final String  MEMBER_NAME="member_name";//用户姓名
    public static void init(Context context) {
        infoShare = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
    }

    public static void putString(String key, String value){
        SharedPreferences.Editor editor=infoShare.edit();
        editor.putString(key,value);
        editor.commit();
    }
    public static String getString(String key, String defaultValue){
        return infoShare.getString(key,defaultValue);
    }
    public static void putInt(String key, int value){
        SharedPreferences.Editor editor=infoShare.edit();
        editor.putInt(key,value);
        editor.commit();
    }
    public static int getInt(String key, int defaultValue){
        return infoShare.getInt(key,defaultValue);
    }
    public static void putBoolean(String key, boolean value){
        SharedPreferences.Editor editor=infoShare.edit();
        editor.putBoolean(key,value);
        editor.commit();
    }
    public static boolean getBoolean(String key, boolean defaultValue){
        return infoShare.getBoolean(key,defaultValue);
    }


}
